Fix user password reset mail template value #12882
Fix user password reset mail template value #12882erikbocks wants to merge 10 commits intoapache:4.22from
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 4.22 #12882 +/- ##
============================================
+ Coverage 3.70% 17.60% +13.89%
- Complexity 0 15674 +15674
============================================
Files 448 5918 +5470
Lines 38041 531668 +493627
Branches 7038 65001 +57963
============================================
+ Hits 1409 93590 +92181
- Misses 36445 427522 +391077
- Partials 187 10556 +10369
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
engine/schema/src/main/resources/META-INF/db/schema-42200to42210.sql
Outdated
Show resolved
Hide resolved
Co-authored-by: GaOrtiga <49285692+GaOrtiga@users.noreply.github.com>
engine/schema/src/main/resources/META-INF/db/schema-42200to42210.sql
Outdated
Show resolved
Hide resolved
| SET value = 'Hello {{username}}!\nYou have requested to reset your password. Please click the following link to reset your password:\n{{{resetLink}}}\nIf you did not request a password reset,please ignore this email.\n\nRegards,\nThe CloudStack Team' | ||
| WHERE value IN ( | ||
| 'Hello {{username}}!\nYou have requested to reset your password. Please click the following link to reset your password:\nhttp://{{{resetLink}}}\nIf you did not request a password reset,please ignore this email.\n\nRegards,\nThe CloudStack Team', | ||
| 'Hello {{username}}!\nYou have requested to reset your password. Please click the following link to reset your password:\n{{{domainUrl}}}{{{resetLink}}}\nIf you did not request a password reset,please ignore this email.\n\nRegards,\nThe CloudStack Team' |
There was a problem hiding this comment.
agree to update the value if it has the previous defaults. ConfigDepot does not update value.
Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com>
engine/schema/src/main/resources/META-INF/db/schema-42200to42210.sql
Outdated
Show resolved
Hide resolved
Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com>
|
@blueorangutan package |
|
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17265 |
| WHERE value IN ( | ||
| 'Hello {{username}}!\nYou have requested to reset your password. Please click the following link to reset your password:\nhttp://{{{resetLink}}}\nIf you did not request a password reset,please ignore this email.\n\nRegards,\nThe CloudStack Team', | ||
| 'Hello {{username}}!\nYou have requested to reset your password. Please click the following link to reset your password:\n{{{domainUrl}}}{{{resetLink}}}\nIf you did not request a password reset,please ignore this email.\n\nRegards,\nThe CloudStack Team' | ||
| ) |
There was a problem hiding this comment.
@erikbocks the sql doesn't work, \n is not required in the update stmt. can you try and update the pr with the below stmt. thanks.
UPDATE `cloud`.`configuration`
SET value = 'Hello {{username}}!
You have requested to reset your password. Please click the following link to reset your password:
{{{resetLink}}}
If you did not request a password reset, please ignore this email.
Regards,
The CloudStack Team'
WHERE name = 'user.password.reset.mail.template' AND
value IN (
'Hello {{username}}!
You have requested to reset your password. Please click the following link to reset your password:
http://{{{resetLink}}}
If you did not request a password reset, please ignore this email.
Regards,
The CloudStack Team',
'Hello {{username}}!
You have requested to reset your password. Please click the following link to reset your password:
{{{domainUrl}}}{{{resetLink}}}
If you did not request a password reset, please ignore this email.
Regards,
The CloudStack Team'
);
engine/schema/src/main/resources/META-INF/db/schema-42200to42210.sql
Outdated
Show resolved
Hide resolved
Co-authored-by: GaOrtiga <49285692+GaOrtiga@users.noreply.github.com>
|
@sureshanaparti Which DB are you using? I tested with MariaDB V15.1 and it worked. I'm thinking it could be an issue with how different DBs handle these line breaks. |
@erikbocks I tested with MySQL 8.0.45, let me check with latest changes. |
|
@blueorangutan package |
|
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17320 |
…10.sql Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com>
engine/schema/src/main/resources/META-INF/db/schema-42200to42210.sql
Outdated
Show resolved
Hide resolved
Co-authored-by: GaOrtiga <49285692+GaOrtiga@users.noreply.github.com>
|
@blueorangutan package |
|
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 17331 |
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
Description
The #11379 and #12078 PRs changed the user password email template, stored in the
user.password.reset.mail.templateconfiguration value. However, these changes were only made to the configuration's default value, and the database's configuration value was not changed. This caused environments that were deployed before the4.22.0.0release to face errors due to outdated configuration values, such as the duplicated HTTP protocol in the URL.This PR adds a step in the
4.22.0.0version to4.22.1.0version update script to update theuser.password.reset.mail.templateconfiguration value to the current value, if its current value matches one of the old defaults. The step changes the configuration's value only if the current value is one of the outdated default ones, keeping customized templates untouched.Old default templates
domainUrl:New default template
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
In an environment where the
user.password.reset.mail.templateconfiguration had thehttp://value, I manually executed the query to replace the configuration's value, and asserted that the value was changed accordingly. Then, I updated the configuration to the{{{domainUrl}}}outdated template, and manually executed the query one more time. The configuration's value was updated to the current template successfully.In order to test ACS' automatic update behavior, the query was inserted to the version update SQL file, and the packages with the changes were installed in an environment previous to the
4.22.1.0version. The correct behavior was observed for both of the outdated templates.With the environment updated in the previous step, a password reset email was sent, and I validated that the template was working properly.